package com.itheima.mapper;

import com.itheima.pojo.Emp;
import com.itheima.pojo.EmpQueryParam;
import com.itheima.pojo.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface EmpMapper {


    int deleteById(List<Integer> ids);

    Emp getById(Integer id);

    void updateById(Emp emp);
    @MapKey(value = "pos")
    List<Map<String, Object>> countEmpJobData();
    @MapKey(value = "name")
    List<Map> countEmpGenderData();

    List<Emp> list(EmpQueryParam empQueryParam);

    //获取创建人员的主键ID
    @Options(useGeneratedKeys = true,keyProperty = "id")
    //增加数据
    @Insert("insert into emp(username, name, gender, phone, job, salary, image, entry_date, dept_id, create_time, update_time) " +
            "values (#{username},#{name},#{gender},#{phone},#{job},#{salary},#{image},#{entryDate},#{deptId},#{createTime},#{updateTime})")
    void insert(Emp emp);

    //作业一：查询全部员工
    @Select("select * from emp")
    List<Emp> selectAll();


    int deptEmpCount(@Param("id") List<Integer> id);


@Select("select * from emp where username=#{username} and password=#{password}")
    Emp getUsename(Emp emp);
}

